package com.itzhoun.createModel.factory;

import com.itzhoun.model.OpenerLog;
import com.itzhoun.service.OpenerLogService;
import com.itzhoun.spring.SpringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.TimerTask;

/**
 * @author 周楠
 * @Date 2022/07/30/上午 12:52
 */
public class AsyncFactory {

    private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user");

    /**
     *
     * @return
     */
//    public static TimerTask recordLoginInfo(final String username, final String status, final String message, final Object... args){
//        UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User_Agent"));
//
//    }

    /**
     * 操作日志记录
     *
     * @param operLog 操作日志信息
     * @return 任务task
     */
    public static TimerTask recordOper(final OpenerLog operLog)
    {
        return new TimerTask()
        {
            @Override
            public void run()
            {
                // 远程查询操作地点
                SpringUtils.getBean(OpenerLogService.class).save(operLog);
            }
        };
    }
}
